package com.yupi.yuoj.model.enums;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

/**
 * @Classname QuestionArithmeticRatingEnum
 * @Description 题目算术评级枚举
 * @Date 2025/10/4 23:06
 * @Created by 李胜
 */
public enum QuestionArithmeticRatingEnum {
    EASY("简单", 3),
    MEDIUM("中等", 6),
    HARD("困难", 9);


    private final String text;

    private final int value;

    QuestionArithmeticRatingEnum(String text, int value) {
        this.text = text;
        this.value = value;
    }

    public static QuestionArithmeticRatingEnum getEnumByValue(int value) {
        if (value<=EASY.getValue()) {
            return EASY;
        } else if (value<= MEDIUM.getValue()) {
            return MEDIUM;
        } else {
            return HARD;
        }
    }

    public static List<Integer> getValues() {
        return Arrays.stream(values()).map(QuestionArithmeticRatingEnum::getValue).collect(Collectors.toList());
    }
    public String getText() {
        return text;
    }

    public int getValue() {
        return value;
    }
}
